

public class Joystick extends InputDevice{
	
	/****************************************
	 * Attributes
	 ****************************************/
	// Flags for this class
	public static final int CENTER = 0;
	public static final int UP = 3;
	public static final int DOWN = 1;
	public static final int LEFT = 2;
	public static final int RIGHT = 4;
	public static final int PRESSED = 5;
	
	
	/****************************************
	 * Constructor
	 ****************************************/
	public Joystick(int address, iCATch316 iCatch) {
		super(address, iCatch);
	}
	
	
	/****************************************
	 * Return the current reading
	 ****************************************/
	@Override
	public int getReading() {
		return Integer.parseInt(iCatch.getJoystickReading(address));
	}

	
	/****************************************
	 * Check whether the joystick is being
	 * pressed
	 ****************************************/
	public boolean isPressed() {
		return (getReading() == PRESSED);
	}
	
	
	/****************************************
	 * Get the direction of the joystick
	 ****************************************/
	public int getDirection() {
		return getReading();
	}
}
